Skip to content

fix: harden routed preview recovery boundaries#2103

Merged
chubes4 merged 5 commits into
mainfrom
fix-2094-route-fetch-redaction
Jul 26, 2026
Merged

fix: harden routed preview recovery boundaries#2103
chubes4 merged 5 commits into
mainfrom
fix-2094-route-fetch-redaction

Conversation

@chubes4

@chubes4 chubes4 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • harden the merged fix: contain routed preview fetch failures #2096 fix by sanitizing request URLs at network serialization and browser result composition boundaries
  • restrict routed retries and manual redirect following to explicitly safe methods, while containing every Playwright route callback operation
  • close the browser before a registration-aware final drain and run the routing security suite in required CI

Post-merge hardening for #2094 and #2096.

Security hardening

Browser network records now redact query values and request failure text before entering network.jsonl. The session result builder independently sanitizes requested, final, preview, topology, and network URLs before composing review, summary, artifact, and stdout projections. Regression coverage sends synthetic sentinels through the real serializers, BrowserArtifactSession, and BrowserProbeSessionResultBuilder, then proves absence from persisted network/errors/summary/review files, the artifact object, stdout, and stderr projections.

Retry safety

  • only GET, HEAD, and OPTIONS receive bounded transient transport retries
  • document and fetch/XHR POST failures receive one attempt and are never replayed by recovery
  • non-idempotent redirect responses are fulfilled back to the browser instead of being manually re-fetched

Route lifecycle

  • the full callback boundary now contains invalid-URL continue, policy abort, ordinary continue, routed fetch, and fulfill failures
  • expected disposed or closed page/context/browser errors are swallowed during cleanup
  • unexpected failures become sanitized operation-classified tracker diagnostics
  • route registrations are counted during drain, and the authoritative drain runs after browser shutdown to prevent late arrivals

CI

test:browser-preview-routing is now included in both the required smoke check group and the agent-task contracts workflow.

Test results

  • npm run build passed
  • npm run test:browser-preview-routing passed (11 tests)
  • npm run test:browser-accessibility-oracles passed (47 tests)
  • npm run test:browser-diagnostic-providers passed
  • npm run test:browser-artifact-session passed
  • npm run test:redaction passed
  • npm run test:production-boundary-enforcement passed
  • git diff --check passed
  • npm run check executed and passed the newly required routing suite, then stopped at the unrelated pre-existing command-registry assertion tracked in command-registry-smoke fails on main: wordpress.collect-workload-result outputShape missing outputSchema id mention #1745

@chubes4

chubes4 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

Security re-review changes are ready in 1eefc9aa.

Addressed:

  • shared URL/result sanitization for JSON artifact writes, returned/error artifacts, and stdout across probe, actions/scenario, editor, and multi-actor commands
  • real-browser action, editor-open, and multi-actor artifact/stdout sentinel coverage
  • tracked callback operations plus registration-aware close/final-drain lifecycle in every routed consumer
  • cleanup containment so geolocation or browser close failures cannot skip final drain or artifact composition
  • broad runtime-playground/browser/editor workflow path filters and both security suites in required CI

Validation:

An unrelated baseline test:editor-actions fixture crash is tracked separately in #2105.

@chubes4
chubes4 force-pushed the fix-2094-route-fetch-redaction branch from 1eefc9a to 5ea1b62 Compare July 26, 2026 17:47
@chubes4

chubes4 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

Rebase follow-up complete. New head: 5ea1b621.

  • rebased non-interactively onto current origin/main (ab8f91c9, Fix canonical routed preview origins #2098)
  • preserved Fix canonical routed preview origins #2098 canonical-origin contextOptions() / localProxyOrigin routing
  • preserved shared URL/result sanitization and tracked close/final-drain lifecycle
  • build passed
  • routing security suite passed (12 tests)
  • real routed action/editor/multi-actor suite passed
  • pinned workflow lint passed
  • branch is clean and GitHub reports MERGEABLE; required contracts checks are currently in progress

No merge, release, or deployment performed.

@chubes4
chubes4 force-pushed the fix-2094-route-fetch-redaction branch from 5ea1b62 to 8af4397 Compare July 26, 2026 18:09
@chubes4

chubes4 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

Residual security/lifecycle review fixes are ready on head 8af43977.

Completed:

  • embedded absolute/relative URL and sensitive query assignment redaction in ordinary persisted text, with real console capture proving normal text remains intact
  • real failing-command stderr coverage for actions, scenario, editor, and multi-actor
  • editor-canvas routed tracker plus bounded close/final drain and post-drain summary composition
  • probe cancellation and final checkpoint/lifecycle failure paths now continue through bounded close/drain and reviewer-safe artifact composition
  • browser close has a deterministic timeout and cannot block route drain
  • unexpected abort failures in recoverable fetch, redirect escape, and redirect limit paths are operation-classified and tracked; expected closed/disposed aborts remain quiet
  • preserved Fix canonical routed preview origins #2098 canonical routing, POST replay safety, and fix: harden adaptive policy block evidence #2101 adaptive policy evidence

Validation passed:

Branch is clean and GitHub reports MERGEABLE; required checks are running. No merge, release, or deployment performed.

@chubes4
chubes4 force-pushed the fix-2094-route-fetch-redaction branch from 8af4397 to 39dda74 Compare July 26, 2026 18:22
@chubes4

chubes4 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

Final rebase onto 3f9ca387 is complete at head 39dda74d.

The overlap was resolved additively:

  • preserved fix: preserve browser environments across action journeys #2099 shared browser environment/session continuity, observed evidence, adaptive identity, and recipe behavior
  • shared sessions now carry fix: harden routed preview recovery boundaries #2103's route tracker across probe and actions
  • probe/actions drain routed work between phases without closing the shared runtime
  • scenario teardown performs the authoritative bounded runtime/browser close and final registration-aware drain
  • retained sanitizer, cancellation, canonical-origin, POST replay, and error-classification boundaries

Validation passed:

  • build
  • browser preview routing security (14 tests)
  • real routed-command security
  • canonical preview origin and callback materialization contracts
  • browser environment matrix (13 tests)
  • browser actions environment/session continuity (8 tests)
  • browser scenarios
  • adaptive/accessibility observed-evidence suite (50 tests)
  • pinned workflow lint
  • diff checks

Branch is clean, pushed with lease, and GitHub reports MERGEABLE. Required checks are running. No merge, release, or deployment performed.

@chubes4

chubes4 commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator Author

HIGH blocker fixed at head 63d3adbd.

runBrowserScenarioCommand now:

  • computes the full preview topology before creating the shared probe/actions environment context
  • includes server.previewProxyDiagnostics?.targetOrigin in topology evidence
  • merges topology.contextOptions() with imported storage state
  • retains the shared route tracker, phase drains, bounded final close, and registration-aware final drain

Added a real probe-plus-actions intersection regression using an unresolvable .invalid canonical host, disposable local proxy, and local upstream. It proves:

  • canonical browser-origin navigation succeeds only through the disposable proxy
  • the local upstream receives the canonical-host request
  • probe-created session state remains available to actions
  • probe and actions retain the canonical URL
  • artifacts expose canonical browser, local proxy, and upstream runtime origins

Passed:

  • build
  • canonical-origin and callback materialization contracts
  • browser environment continuity, including the new regression (9 tests)
  • browser environment matrix (13 tests)
  • routing security (14 tests)
  • real routed-command security
  • browser scenarios
  • pinned workflow lint and diff checks

Branch is clean, current with origin/main, and GitHub reports MERGEABLE. Required checks are running. No merge, release, or deployment performed.

@chubes4
chubes4 merged commit 4366692 into main Jul 26, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant